package com.wlxk.crawler.core.exception;

/**
 * @author PanQiangQiang
 * @since 2021-11-04 11:32:16
 */
public class WlxkException extends RuntimeException {

    private final Integer code;

    public WlxkException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }

    public WlxkException(String msg) {
        this(WlxkErrEnum.UNKNOWN.code, msg);
    }

    public WlxkException(WlxkErrEnum errEnum) {
        this(errEnum.code, errEnum.msg);
    }

    public WlxkException(WlxkErrEnum errEnum, String msg) {
        this(errEnum.code, msg);
    }

    public Integer getCode() {
        return code;
    }

    @Override
    public String toString() {
        return "WlxkException{" + "code=" + code + ", message=" + this.getMessage() + '}';
    }
}
